<?php
namespace Lib\Alidayu;
include('TopSdk.php');
use TopClient;
use AlibabaAliqinFcSmsNumSendRequest;
/*
 * 使用方法 下载阿里大于官方sdk 在Library下创建Lib目录 将官方sdk全部放入lib目录下 (ThinkPHP/Library/Lib/Alidayu)
 * 在Alidayu下创建 SendSMS 复制下面代码 修改阿里大于配置
 *
 * 调用方法
 * use Lib\Alidayu\SendSMS;
 *  public function Alidayu()
 * {
 *      $alidayu = new SendSMS();
 *      $result = $alidayu->send($recNum='手机号',$smsParam='{"code":"1234"}',$smsTemplateCode='SMS_xxxxxxxx',$smsFreesignName='签名');
 *      print_r($result);
 * }
 */
class SendSMS{
    public function send($recNum,$smsParam,$smsTemplateCode,$smsFreesignName)
    {
        $c = new TopClient;
        $c ->appkey = '23902026' ;
        $c ->secretKey = '49c87bd870cf085f9792b9a6f351096f' ;
        $req = new AlibabaAliqinFcSmsNumSendRequest;
        $req ->setExtend("123456");
        $req ->setSmsType("normal");
        $req ->setSmsFreeSignName($smsFreesignName);
        $req ->setSmsParam($smsParam);
        $req ->setRecNum($recNum);
        $req ->setSmsTemplateCode($smsTemplateCode);
        $resp = $c ->execute( $req );
        return $resp;
    }
}